<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:h="http://xmlns.jcp.org/jsf/html"
                xmlns:p="http://primefaces.org/ui"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:f="http://xmlns.jcp.org/jsf/core"
                xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
                template="templates/template.xhtml">
    <ui:define name="headScripts">
        <title>Facelet Title</title>
    </ui:define>
    <ui:define name="content">
        <form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
            <input type="hidden" name="cmd" value="cart"/>
            <input type="hidden" name="upload" value="1"/>
            <c:set var="dem" value="1"/>
            <c:forEach items="#{shoppingCart.cart}" var="i">
                <input type="hidden" name="item_number_#{dem}" value="#{i.p.prodId}"/>
                <input type="hidden" name="item_name_#{dem}" value="#{i.p.prodName}"/>
                <input type="hidden" name="quantity_#{dem}" value="#{i.quantity}"/>
                <input type="hidden" name="amount_#{dem}" value="#{i.p.prodPrice}"/>
                <c:set var="dem" value="#{dem+1}"/>
            </c:forEach>
            <input type="hidden" name="business" value="yuri.afik@gmail.com"/>
            <input type="hidden" name="return" value="http://localhost:8080/online_shoping/success.xhtml"/>
            <input type="hidden" name="cancel" value="http://localhost:8080/online_shoping/fail.xhtml"/>
            <input type="hidden" name="return" value="http://localhost:8080/online_shoping/success.xhtml"/>
            <input type="image" name="submit" border="0" src="https://www.paypalobjects.com/en_US/i/btn/btn_buynow_LG.gif"
                   alt="Paypal - The safer, easier way to pay online"/>
        </form>
    </ui:define>
</ui:composition>